home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Microsoft Plateform / Visual Basic 5.0 / Msvb50.ace / msvb50 / MSVB50 / VB / WIZARDS / TEMPLATE / WIZARD.CLS < prev    next >
Encoding:
Visual Basic class definition  |  1996-10-24  |  2.4 KB  |  77 lines

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4. END
  5. Attribute VB_Name = "Wizard"
  6. Attribute VB_GlobalNameSpace = False
  7. Attribute VB_Creatable = True
  8. Attribute VB_PredeclaredId = False
  9. Attribute VB_Exposed = True
  10. Attribute VB_Description = "Wizard Template"
  11. Option Explicit
  12.  
  13. Implements IDTExtensibility
  14.  
  15. Dim mcbMenuCommandBar         As Office.CommandBarControl  'command bar object
  16. Public WithEvents MenuHandler As CommandBarEvents          'command bar event handler
  17. Attribute MenuHandler.VB_VarHelpID = -1
  18. Dim mfrmWizard As frmWizard
  19. Dim VBInstance As VBIDE.VBE
  20.  
  21.  
  22. '------------------------------------------------------
  23. 'this method adds the Add-In to the VB menu
  24. 'it is called by the VB addin manager
  25. '------------------------------------------------------
  26. Private Sub IDTExtensibility_OnConnection(ByVal VBInst As Object, ByVal LoadMode As vbext_ConnectMode, ByVal AddInInst As VBIDE.AddIn, custom() As Variant)
  27.    On Error GoTo error_handler
  28.    
  29.    Set VBInstance = VBInst
  30.    
  31.    If LoadMode = vbext_cm_External Then
  32.        'Used by the wizard toolbar to start this wizard
  33.        LoadMe
  34.    Else
  35.        Set mcbMenuCommandBar = AddToAddInCommandBar(VBInst, LoadResString(15), LoadResPicture(5000, 0))
  36.        'sink the event
  37.        Set Me.MenuHandler = VBInst.Events.CommandBarEvents(mcbMenuCommandBar)
  38.    End If
  39.   
  40.    Exit Sub
  41.      
  42. error_handler:
  43.    MsgBox Err.Description
  44. End Sub
  45.  
  46. '------------------------------------------------------
  47. 'this method removes the Add-In from the VB menu
  48. 'it is called by the VB addin manager
  49. '------------------------------------------------------
  50. Private Sub IDTExtensibility_OnDisconnection(ByVal RemoveMode As vbext_DisconnectMode, custom() As Variant)
  51.     'delete the command bar entry
  52.     mcbMenuCommandBar.Delete
  53. End Sub
  54.  
  55. Private Sub IDTExtensibility_OnStartupComplete(custom() As Variant)
  56.   'stub needed
  57. End Sub
  58.  
  59. Private Sub IDTExtensibility_OnAddInsUpdate(custom() As Variant)
  60.   'stub needed
  61. End Sub
  62.  
  63. 'this event fires when the menu is clicked in the IDE
  64. Private Sub MenuHandler_Click(ByVal CommandBarControl As Object, handled As Boolean, CancelDefault As Boolean)
  65.     LoadMe
  66. End Sub
  67.  
  68. Private Sub LoadMe()
  69.     Set mfrmWizard = New frmWizard
  70.     'pass the vb instance to the wizard module
  71.     Set mfrmWizard.VBInst = VBInstance
  72.     'load and show the form
  73.     mfrmWizard.Show vbModal
  74.     Set mfrmWizard = Nothing
  75. End Sub
  76.  
  77.